<style type="text/css">
.channeldetail{
	margin:20px;
}
.channeldetail table{
	margin-top:20px;
}
.channeldetail span{
	font-weight:bold;
}
</style>
<script type="text/javascript">
var channeltype='';
$(document).ready(function(e) {
	channeltype=$('.channeldetail .typeedit').text();
	switch(channeltype){
	case 'article':$('.channeldetail .typeedit').text('内容显示');break;
	case 'list':$('.channeldetail .typeedit').text('内容列表');break;
	case 'url':$('.channeldetail .typeedit').text('超链接');break;
	}
	$('.channeldetail table span').filter(function(index) {
		return $(this).attr('class')!='typeedit';
    }).click(function(e){
		input_edit(this,'system/channel!save.action');
	});
	$('.channeldetail .typeedit').click(function(e){
		var sel=$('<select name="type"><option value="article">内容显示</option><option value="list">内容列表</option><option value="url">超链接</option></select>').hide();
		var ops=$(sel).children();
		for(var i=0;i<ops.length;i++){
			if($(ops).eq(i).text()==$(this).text())
				$(ops).eq(i).attr('selected',true);
		}
		$(sel).blur(function(e) {
			input_save(this,'system/channel!save.action');
		});
		$(this).after(sel);
		$(this).hide();
		$(sel).toggle('fast');
	});
	var channelid='${channel._id}';
	if(channeltype!='url'){
		goPage('system/channelOption.action?channelid='+channelid,'.channeloption');
	}
	$.get("system/template!option.action",function(rs,s,q){
		var ops=$('select').html(rs);
		$('.template').each(function(index, element) {
            var name=ops.children('[value='+$(this).text()+']').html();
			$(this).children().text(name)
        });
	});
});
</script>
<div class="channeldetail">
  <button onClick="goPage('system/channel!detail.action?id=${channel._id}','#main')">刷新模块信息</button>
  <table class="tablestyle1">
    <caption>模块信息</caption>
    <tr>
      <th class="col2">编号</th>
      <td>${channel._id}</td>
    </tr>
    <tr>
      <th class="col2">名称</th>
      <td><span type="text" regx="${check.name}" name="name" id="${channel._id}">${channel.name}</span></td>
    </tr>
    <tr>
      <th class="col2">排序</th>
      <td><span type="number" regx="${check.index}" name="index" id="${channel._id}">${channel.index}</span></td>
    </tr>
    <tr>
      <th class="col2">关键词</th>
      <td><span type="text" regx="${check.key}" name="key" id="${channel._id}">${channel.key}</span></td>
    </tr>
    <tr>
      <th class="col2">父模块</th>
      <td>${channel.parent.name}</td>
    </tr>
    <tr>
      <th>类型</th>
      <td class="type"><span class="typeedit" type="select" name="type" id="${channel._id}">${channel.type}</span></td>
    </tr>
    <tr>
      <th>访问地址</th>
      <td><span type="text" regx="${check.url}" name="url" id="${channel._id}">${channel.url}</span></td>
    </tr>
    <tr>
      <th>内容模板</th>
      <td class="template"><span type="select" src="system/template!option.action" name="templateid" id="${channel._id}">${channel.templateid!"未选择模板"}</span></td>
    </tr>
    <#if channel.type=="list">
    <tr>
      <th>列表模板</th>
      <td class="template"><span type="select" src="system/template!option.action" name="listtemplate" id="${channel._id}">${channel.listtemplate!"未选择模板"}</span></td>
    </tr>
    </#if>
  </table>
  <#if channel.type != "url">
  <div class="channeloption">
  </div>
  </#if>
</div>
